package com.itheima.tcpcn;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class ServerDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(10060);
        Socket accept = serverSocket.accept();
        InputStream inputStream = accept.getInputStream();
        int b ;
        while((b=inputStream.read())!=-1){
            System.out.print((char) b);
        }
        OutputStream outputStream = accept.getOutputStream();
        outputStream.write("你好".getBytes());
        outputStream.close();
        inputStream.close();
        accept.close();
        serverSocket.close();
    }
}
